<template>
	<view>
		<u-modal :show="show" :title="title" @confirm="confirm">
			<view class="slot-content">
				<view class="">
					<view class="">
						<view class="">
								公司名称:{{companyName}} 
						</view>
					
						<image style="height:250rpx;width: 250rpx;" :src="src()" mode=""></image>
					</view>
				</view>
			</view>
		</u-modal>
		<u-cell-group>


	<view class="qh" @click="qh">
		<view class="">
			{{companyName}} >
		</view>
	</view>
	<view class="gg">
		<view class="">
			通知公告: 我是测试公告
		</view>
	</view>
	
	
			<u-cell size="large" isLink url="/pages/myinfo/myinfo" >
				<template slot='label'>
					<view style="margin: 2rpx;font-size: 40rpx;">{{userName}}   {{phone}}</view>
					<view style="margin: 2rpx;">{{userType}}</view>
				</template>

			</u-cell>
			<u-cell  size="large" title="企业认证" isLink url="/pages/mycompany/mycompany">
				<u-icon slot="icon" size="32" name="grid"></u-icon>
				<template slot='label'>
					<view style="margin: 2rpx;">已认证{{mount}}家企业</view>
				</template>
			</u-cell>
			<u-cell  @click="show=true" size="large" title="企业二维码" isLink>
				<u-icon slot="icon" size="32" name="scan"></u-icon>
			</u-cell>

			<u-cell size="large" title="退出" isLink @click="quit">
				<u-icon slot="icon" size="32" name="share-square"></u-icon>
			</u-cell>
		</u-cell-group>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mount:0,
				phone:"",
				companyName:"",
				companyId:"",
				show: false,
				userType:"",
				userName: "未知用户",
				isSuperAdmin: ""
			}
		},
		methods: {
			
			getMount(){
				var that=this
				this.api.get("/company/findMyCompany/"+this.$store.state.userId, {
					
				}).then(res => {
					console.log(res.data)
					that.mount=res.pageCount
					console.log(res);
				})
			},
			qh(){
				uni.navigateTo({
					url:"/pages/login/login"
				})
			},
			confirm() {

				// 3秒后自动关闭
				this.show = false;

			},
			src(){
				return "http://localhost:8080/code?content="+this.companyId
			},
			quit() {
				this.$store.commit('quit')
				uni.reLaunch({
					url: "/pages/register/register"
				})

			}
		},
		onShow() {
			this.companyId=this.$store.state.myCompanyId
				this.companyName=this.$store.state.myCompanyName
				this.phone=this.$store.state.phone
			this.userName = this.$store.state.userName
			if (this.$store.state.ownCompanyUserId === this.$store.state.userId) {
				this.userType = "超级管理员"
			}else if(this.$store.state.userType=='2' && this.userType !== "超级管理员"){
					this.userType = "管理员"
			}else{
				this.userType = "员工"
			}
			
		  this.getMount()
			
		
		},
		onLoad() {
			
		}
	}
</script>

<style>
.qh{
	width: 100%;
	height: 60rpx;
	font-size: 38rpx;
	font-weight: 600;
	margin: 20rpx;
}
.gg{
	width: 100%;
	height:40rpx;
	border-top: #999999 1px solid;
	border-bottom:  #999999 1px solid;
	padding: 17rpx;
}
</style>
